package com.wolfeyes.common.utils.network.web;

import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;

import com.wolfeyes.common.utils.framework.spring.SpringContextUtils;

/**
 * @title 获取i18n资源文件中的信息工具类
 * @author yanyljava
 * @email yanyljava@qq.com
 * @create 2020-09-03 11:04
 **/
public class MessageUtils {

	/**
	 * @title 根据消息键和参数 获取消息
	 * @param code
	 * @param args
	 * @return
	 */
	public static String message(String code, Object... args) {
		
		MessageSource messageSource = SpringContextUtils.getBean(MessageSource.class);
		return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
	}

}
